import unittest
from api.base import Base
from loguru import logger
from HTMLTestRunner import HTMLTestRunner


if __name__ == '__main__':

    # 1. 生成日志
    logger.add('logs/litemall.log')

    #  2. 登录
    base = Base()
    base.login()

    # 3. 搜集用例，创建套件
    suite = unittest.TestLoader().discover('cases','test_user*.py')

    test_report = 'test_report.html'
    # 4. 生成测试报告。
    with open(test_report,'wb') as f:
        runner = HTMLTestRunner(f,title='litemall测试报告',description='简化版的自动化测试框架')
        runner.run(suite)